home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: netcom.com!marnold
- From: marnold@netcom.com (Matt Arnold)
- Subject: Re: DLL's with classes in them
- Message-ID: <marnoldDnBryC.3ox@netcom.com>
- Organization: NETCOM On-line Communication Services (408 261-4700 guest)
- References: <4gkvhk$b1v@nms.telepost.no> <4gmpbs$cvl@news1.usa.pipeline.com>
- Date: Sun, 25 Feb 1996 09:34:59 GMT
- Sender: marnold@netcom20.netcom.com
-
- grantp@usa.pipeline.com(Pete) writes:
-
- >On Feb 23, 1996 18:03:31 in article <Re: DLL's with classes in them>,
- >'Carsten Arnholm <ca@sesam.dnv.no>' wrote:
- >
- >
- >>J P Crocker <whl.adv.eng@dial.pipex.com> wrote:
- >>>Here's one...
- >>>
- >>>I'm using Borland Turbo C++ 3.1, and am trying to create a DLL with a
- >class
- >>>definition which I can import into my App. I've decared the class in the
- >DLL
- >>
- >> .. [ sample deleted ] ..
- >>
- >>Unfortunately, I do not believe this is possible. DLL's support only
- >C-style
- >>API functions. You can have objects inside & outside the DLL, but you
- >cannot
- >>import or export such objects.
- >>
- >>If someone can prove me wrong, I would be most grateful.
- >>
- >Ok, I'll take the bait :-). Two commercial examples of class libraries
- >implemented as DLL's:
- >
- > MFCxx.DLL
- > OWLxx.DLL
-
- That's right, the orignal poster is wrong. Both Borland and Microsoft
- (and I'm sure others) offer way to export whole C++ classes from DLLs.
- Unfortunately (aside from just the name-"mangling/decorating" issues
- which usually foul-up cross-compiler C++ linking), each vendor's versions
- of exported classes is usually not compatible with the others' (either
- because of the name mismatches or because of the techniques used to
- export classes).
-
- So, it is definitely possible to use an object whose (C++) code resides
- in a DLL (I've done it!). But, if you choose to use this approach, be
- sure that everyone who will use your DLLs has the same brand of C++
- compiler you do. If you want your DLL to be the most compatible, stick
- with normal C-style exported functions.
-
- Keep in mind that there *is* a cross-compiler, totally compatible way to
- export objects from DLLs (and even applications). It's called OLE 2.0.
-
- Regards,
- -------------------------------------------------------------------------
- Matt Arnold | | ||| | |||| | | | || ||
- marnold@netcom.com | | ||| | |||| | | | || ||
- Boston, MA | 0 | ||| | |||| | | | || ||
- 617.389.7384 (h) 617.576.2760 (w) | | ||| | |||| | | | || ||
- C++, MIDI, Win32/95 developer | | ||| 4 3 1 0 8 3 || ||
- -------------------------------------------------------------------------
-